package com.javathread.th5;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * Hashmap put操作会引起死循环,hashmap
 * @author Administrator
 *分段存储
 */
public class ChmDemo {
	public static void main(String[] args) {
		ConcurrentLinkedQueue queue;
		//创建一个安全map   键 - 值
		ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>();
		//jdk 1.7及以前
		//jdk 1.8以后 分段锁
		
		map.put("001", "张飞");
		map.put("002", "赵云");
		map.put("003", "诸葛亮");
		
		System.out.println("--------------------------------------------");
		System.out.println("学生编号002 的同学名称是" + map.get("002"));
		map.put("002",  "司马懿");
		System.out.println("学生编号002 的同学名称是" + map.get("002"));
	}
}
